from django.db import models
from django.contrib.auth.models import User

# Create your models here.

class Category(models.Model):
    name = models.CharField(maxlength = 50)
    class Admin:
        pass
    def __str__(self):
        return self.name

class Season(models.Model):
    name = models.CharField(maxlength = 50)
    class Admin:
        pass
    def __str__(self):
        return self.name

class Cuisine(models.Model):
    name = models.CharField(maxlength = 50)
    class Admin:
        pass
    def __str__(self):
        return self.name

class Recipe(models.Model):
    name = models.CharField(maxlength = 100)
    date = models.DateField(auto_now=True)
    user = models.ForeignKey(User)
    date = models.DateField(auto_now=True)
    category = models.ForeignKey(Category)
    time_required = models.IntegerField()
    easy = models.IntegerField()
    calories = models.IntegerField(null=True)
    rates = models.IntegerField()
    preparation = models.TextField()
    wine = models.CharField(maxlength = 150)
    cuisine = models.ForeignKey(Cuisine)
    season = models.ForeignKey(Season)
    class Admin:
        pass
    def __str__(self):
        return self.name
        

class Rate(models.Model):
    recipe = models.ForeignKey(Recipe)
    user = models.ForeignKey(User)
    class Admin:
        pass
    def __str__(self):
        return self.name


class Ingredient(models.Model):
    recipe = models.ForeignKey(Recipe)
    quantity = models.CharField(maxlength = 50)
    name = models.CharField(maxlength = 50)
    class Admin:
        pass
    def __str__(self):
        return self.name

class Comment(models.Model):
    user = models.ForeignKey(User)
    recipe = models.ForeignKey(Recipe)
    date = models.DateField(auto_now=True)
    text = models.TextField()
    class Admin:
        pass
    def __str__(self):
        return self.text

